Importing Libaries¶

Importing Data¶

SPF¶

An Excel workbook with multiple worksheets. Each worksheet holds the time series of mean forecasts for the level of a different variable. The first two columns list the year and quarter in which the survey was conducted. The remaining columns give the mean forecasts for all quarterly and annual horizons, as described below ~ SPF Documentation

YEAR QUARTER UNEMP1 UNEMP2 UNEMP3 UNEMP4 UNEMP5 UNEMP6 UNEMPA UNEMPB UNEMPC UNEMPD
0 1968 4 3.5974 3.6218 3.8359 4.0231 3.9910 3.9397 NaN NaN NaN NaN
1 1969 1 3.4000 3.5656 3.7738 3.8525 3.8623 NaN NaN NaN NaN NaN
2 1969 2 3.3036 3.4607 3.6446 3.8196 3.9111 NaN NaN NaN NaN NaN
3 1969 3 3.5036 3.6375 3.8214 3.9304 3.9875 NaN NaN NaN NaN NaN
4 1969 4 3.7055 3.8382 4.1509 4.4127 4.4036 4.3473 NaN NaN NaN NaN
... ... ... ... ... ... ... ... ... ... ... ... ...
211 2021 3 5.9025 5.3207 4.9323 4.6527 4.4176 4.2484 5.5852 4.3777 3.9636 3.9056
212 2021 4 5.1027 4.5741 4.3186 4.1193 3.9808 3.8864 5.4466 4.0762 3.7790 3.8033
213 2022 1 4.2019 3.9308 3.7532 3.6401 3.5942 3.5521 3.7336 3.5308 3.5929 3.7011
214 2022 2 3.8000 3.6034 3.5518 3.5648 3.6089 3.6557 3.6272 3.6860 3.9116 3.9370
215 2022 3 3.6000 3.5676 3.6640 3.7953 3.9310 4.0870 3.6575 4.0235 4.0518 4.0085

216 rows × 12 columns

UNEMP1 UNEMP2 UNEMP3 UNEMP4 UNEMP5 UNEMP6 UNEMPA UNEMPB UNEMPC UNEMPD
PERIOD
1968Q4 3.5974 3.6218 3.8359 4.0231 3.9910 3.9397 NaN NaN NaN NaN
1969Q1 3.4000 3.5656 3.7738 3.8525 3.8623 NaN NaN NaN NaN NaN
1969Q2 3.3036 3.4607 3.6446 3.8196 3.9111 NaN NaN NaN NaN NaN
1969Q3 3.5036 3.6375 3.8214 3.9304 3.9875 NaN NaN NaN NaN NaN
1969Q4 3.7055 3.8382 4.1509 4.4127 4.4036 4.3473 NaN NaN NaN NaN
... ... ... ... ... ... ... ... ... ... ...
2021Q3 5.9025 5.3207 4.9323 4.6527 4.4176 4.2484 5.5852 4.3777 3.9636 3.9056
2021Q4 5.1027 4.5741 4.3186 4.1193 3.9808 3.8864 5.4466 4.0762 3.7790 3.8033
2022Q1 4.2019 3.9308 3.7532 3.6401 3.5942 3.5521 3.7336 3.5308 3.5929 3.7011
2022Q2 3.8000 3.6034 3.5518 3.5648 3.6089 3.6557 3.6272 3.6860 3.9116 3.9370
2022Q3 3.6000 3.5676 3.6640 3.7953 3.9310 4.0870 3.6575 4.0235 4.0518 4.0085

216 rows × 10 columns

FRED Unemployment Rate¶

Starting from the earliest year of SPF (Why unnecessarily load everything?)

UNRATE
DATE
1968-01-01 3.7
1968-02-01 3.8
1968-03-01 3.7
1968-04-01 3.5
1968-05-01 3.5
... ...
2022-05-01 3.6
2022-06-01 3.6
2022-07-01 3.5
2022-08-01 3.7
2022-09-01 3.5

657 rows × 1 columns

Resampling the Data to Quarterly Mean¶

UNRATE
PERIOD
1968Q1 3.733333
1968Q2 3.566667
1968Q3 3.533333
1968Q4 3.400000
1969Q1 3.400000
... ...
2021Q3 5.100000
2021Q4 4.233333
2022Q1 3.800000
2022Q2 3.600000
2022Q3 3.566667

219 rows × 1 columns

Visualization¶